<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  
    <base href="<%=basePath%>">
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	
	<link href="${pageContext.request.contextPath}/assets/css/bootstrap.min.css" rel="stylesheet" />
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css"/>       
	<link href="${pageContext.request.contextPath}/assets/css/codemirror.css" rel="stylesheet">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/ace.min.css" />
	<link rel="stylesheet" href="${pageContext.request.contextPath}/font/css/font-awesome.min.css" />
	<!--[if lte IE 8]>
	  <link rel="stylesheet" href="assets/css/ace-ie.min.css" />
	<![endif]-->
	<script src="${pageContext.request.contextPath}/js/jquery-1.9.1.min.js"></script>
	<script src="${pageContext.request.contextPath}/assets/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/js/H-ui.js"></script>     
	<script src="${pageContext.request.contextPath}/assets/js/typeahead-bs2.min.js"></script>           	
	<script src="${pageContext.request.contextPath}/assets/js/jquery.dataTables.min.js"></script>
	<script src="${pageContext.request.contextPath}/assets/js/jquery.dataTables.bootstrap.js"></script>
	<script src="${pageContext.request.contextPath}/assets/layer/layer.js" type="text/javascript" ></script>          
	<script src="${pageContext.request.contextPath}/assets/laydate/laydate.js" type="text/javascript"></script>
	<script src="${pageContext.request.contextPath}/assets/js/jquery.easy-pie-chart.min.js"></script>
	<script src="${pageContext.request.contextPath}/js/lrtk.js" type="text/javascript" ></script>
	
	<title>出价记录</title>
  </head>

<body>
	<form>
		<input type="hidden" name="opr">
	</form>
	<div class="margin clearfix"">
   		<!--订单列表-->
   		<div class="table_menu_list order_style" id="table_order_list">
     		<div class="search_style" style="background-color:#dcda9a;width:1230px">
     			<form id="form1" action="${pageContext.request.contextPath}/arecordListServlet" method="post">
					<div class="title_names" style="background-color:#a9dacd;">搜索查询</div>
					<ul class="search_content clearfix">
						<li><label class="l_f">买家编号C</label><input name="customer_id" type="text" class="text_add" placeholder="买家编号C" style=" width:250px"></li>
						<li><label class="l_f">时间</label><input class="inline laydate-icon" id="start" name="create_date" style=" margin-left:10px;"></li>
						<li style="width:90px;"><button type="button" class="btn_search" id="queryByCDT"><i class="fa fa-search"></i>查询</button></li>
					</ul>
					<input type="hidden" name="opr">
				</form>
  			</div>
				<br/>
				<br/>
   		<!--订单列表展示-->
		<table class="table table-striped table-bordered table-hover" id="sample-table">
			<thead>
				<tr>
					<th width="25px"><label><input type="checkbox" class="ace"><span class="lbl"></span></label></th>
					<th width="200px">出价记录号</th>
					<th width="200px">拍卖场编号</th>
					<th width="320px">拍卖品名称</th>
					<th width="160px">出价者编号</th>
					<th width="160px">出价幅度</th>
					<th width="160px">出价</th>
	                <th width="170px">出价时间</th>
	                <th width="100px">出价结果</th>                
					<th width="100px">出价记录</th>
				</tr>
			</thead>
			<tbody>
				<c:if test="${lr!=null &&lr.size()>0}">
					<c:forEach items="${lr}" var="r">
						<tr>
							<td><label><input type="checkbox" class="ace"><span class="lbl"></span></label></td>
						 	<td>RC${r.record_id}</td>
							<td>AM${r.auctionMsg_id}</td>
						 	<td>
						 		<c:if test="${lg!=null && lg.size()>0 && lam!=null && lam.size()>0}">
							 		<c:forEach items="${lg}" var="g">
						 				<c:forEach items="${lam}" var="am">
							 				<c:if test="${g.goods_id==am.goods_id&&r.auctionMsg_id==am.auctionMsg_id}">
							 					${g.goods_name}
							 				</c:if>
						 				</c:forEach>
						 			</c:forEach>
						 		</c:if>
						 	</td>
						    <td>C${r.customer_id}</td>
						    <td>
						    	<c:if test="${lm!=null && lm.size()>0 && lam!=null && lam.size()>0}">
						 			<c:forEach items="${lm}" var="mp">
						 				<c:forEach items="${lam}" var="am2">
							 				<c:if test="${mp.markup_id==am2.markup_id && am2.auctionMsg_id==r.auctionMsg_id}">
							 					${mp.markup_money}
							 				</c:if>
						 				</c:forEach>
						 			</c:forEach>
						 		</c:if>
						    </td>
						    <td>${r.money}</td>
						    <td>${r.create_date}</td>
						    <td>
						    	<c:if test="${lam!=null&&lam.size()>0}">
						    		<c:set var="money1" value="${lr.get(0).money}"></c:set>
						    		<c:set var="rid1" value="${r.record_id}"></c:set>
						    		<c:forEach items="${lam}" var="am3">
						    			<c:if test="${am3.auctionMsg_id==r.auctionMsg_id}">
						    				<c:forEach items="${lr}" var="r2">
						    					<c:if test="${r2.money>=money1 && am3.auctionMsg_id==r2.auctionMsg_id}">
						    						<c:set var="money2" value="${r2.money}"></c:set>
						    						<c:set var="rid2" value="${r2.record_id}"></c:set>
						    						<c:set var="money1" value="${money2}"></c:set>
						    						<c:set var="rid1" value="${rid2}"></c:set>
						    					</c:if>
						    				</c:forEach>
						    			</c:if>
						    		</c:forEach>
						    		<c:out value="${money1}+"></c:out><c:out value="${rid1}"></c:out>
						    		<c:forEach items="${lam}" var="am4">
						 				<c:if test="${r.auctionMsg_id==am4.auctionMsg_id}">
								 			<c:choose>
								 				<c:when test="${r.record_id==rid1 && r.money==money1 && am4.goodsState_id==1}">
								 					<span class="label label-success radius">已竞得</span>
								 				</c:when>
								 				<c:otherwise>
								 					<span class="label label-warning radius">未竞得</span>
								 				</c:otherwise>
								 			</c:choose>
						 				</c:if>
						 			</c:forEach>
						 		</c:if>
						    </td>
						    <td>
							    <a title="回到拍卖记录" href="${pageContext.request.contextPath}/recordServlet" class="btn btn-xs btn-info order_detailed" ><i class="fa fa-list bigger-120"></i></a>
						    </td>
					    </tr>
					</c:forEach>
				</c:if>
			</tbody>
   		</table>		
	</div>
  </div>
		<script type="text/javascript">
		
		//时间选择
		 laydate({
		    elem: '#start',
		    event: 'focus' 
		});
		//面包屑返回值
		var index = parent.layer.getFrameIndex(window.name);
		parent.layer.iframeAuto(index);
		$('.Order_form,.order_detailed').on('click', function(){
			var cname = $(this).attr("title");
			var chref = $(this).attr("href");
			var cnames = parent.$('.Current_page').html();
			var herf = parent.$("#iframe").attr("src");
		    parent.$('#parentIframe').html(cname);
		    parent.$('#iframe').attr("src",chref).ready();;
			parent.$('#parentIframe').css("display","inline-block");
			parent.$('.Current_page').attr({"name":herf,"href":"javascript:void(0)"}).css({"color":"#4c8fbd","cursor":"pointer"});
			//parent.$('.Current_page').html("<a href='javascript:void(0)' name="+herf+" class='iframeurl'>" + cnames + "</a>");
		    parent.layer.close(index);
			
		});
		
		 //初始化宽度、高度
		$(".hide_style").height($(".hide_style").height()); 
		 var heights=$(".hide_style").outerHeight(true)+90;  
		 $(".widget-box").height($(window).height()-heights); 
		$(".table_menu_list").width($(window).width()-20);
		 $(".table_menu_list").height($(window).height()-heights);
		  //当文档窗口发生改变时 触发  
		    $(window).resize(function(){
			$(".widget-box").height($(window).height()-heights);
			 $(".table_menu_list").width($(window).width()-20);
			  $(".table_menu_list").height($(window).height()-heights);
			}); 
		//比例 
		var oldie = /msie\s*(8|7|6)/.test(navigator.userAgent.toLowerCase());
					$('.easy-pie-chart.percentage').each(function(){
						$(this).easyPieChart({
							barColor: $(this).data('color'),
							trackColor: '#EEEEEE',
							scaleColor: false,
							lineCap: 'butt',
							lineWidth: 10,
							animate: oldie ? false : 1000,
							size:103
						}).css('color', $(this).data('color'));
					});
				
					$('[data-rel=tooltip]').tooltip();
					$('[data-rel=popover]').popover({html:true});
		</script>
		<script type="text/javascript">
		//订单列表
		jQuery(function($) {
				var oTable1 = $('#sample-table').dataTable( {
				"aaSorting": [[ 1, "desc" ]],//默认第几个排序
				"bStateSave": true,//状态保存
				"aoColumnDefs": [
				  //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
				  {"orderable":false,"aTargets":[0,1,2,3,4,5,6,7,8,9]}// 制定列不参与排序
				] } );
						$('table th input:checkbox').on('click' , function(){
							var that = this;
							$(this).closest('table').find('tr > td:first-child input:checkbox')
							.each(function(){
								this.checked = that.checked;
								$(this).closest('tr').toggleClass('selected');
							});
								
						});
					
					
						$('[data-rel="tooltip"]').tooltip({placement: tooltip_placement});
						function tooltip_placement(context, source) {
							var $source = $(source);
							var $parent = $source.closest('table');
							var off1 = $parent.offset();
							var w1 = $parent.width();
					
							var off2 = $source.offset();
							var w2 = $source.width();
					
							if( parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2) ) return 'right';
							return 'left';
						}
					});
			$("#queryByCDT").click(function(){
				if(($("[name='customer_id']").val().length>0)&&($("[name='create_date']").val().length>0))
					$("[name='opr']").val("cid&cdate");
				else if($("[name='customer_id']").val().length>0)
					$("[name='opr']").val("bycid");
				else if($("[name='create_date']").val().length>0){
					$("[name='opr']").val("bycdate");}
				$("#form1").submit();
			});
		</script>
	</body>
</html>